<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2" />
    <g:set var="entityName" value="${message(code: 'activity.label', default: 'Activity')}" />
    <title>活动详情</title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <!-- Page-header start -->
            <div class="page-header">
                <div class="page-header-title">
                    <h4>活动详情</h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item">
                            <g:link controller="activity" action="index">活动列表</g:link>
                        </li>
                        <li class="breadcrumb-item">活动详情</li>
                    </ul>
                </div>
            </div>
            <!-- Page-header end -->
            <!-- Page-body start -->
            <div class="page-body">
                <g:if test="${flash.message}">
                    <div class="message alert alert-info" role="status">${flash.message}
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span></button>
                    </div>
                </g:if>

                <!-- Hover table card start -->
                <div class="card">
                    <div class="card-header">
                        <h5>活动详情</h5>

                        <div class="card-header-right">
                          <g:if test="${this.follow}">
                            <g:link  controller="follow" action="cancelFollow" id="${this.follow?.id}" data-toggle="tooltip" data-placement="top" title="" data-original-title="取消关注">
                                <i class="fa fa-heart"></i>
                            </g:link>
                          </g:if>
                          <g:else>
                            <g:link  controller="follow" action="addFollow" params="[followObject: 'activity', objectId: this.activity?.id]" data-toggle="tooltip" data-placement="top" title="" data-original-title="关注">
                                <i class="fa fa-heart-o"></i>
                            </g:link>
                          </g:else>
                            <input type="hidden" value="${this.activity?.id}" id="activityId">
                            <g:if test="${this.activity.status == '未执行' || this.activity.status == '已推迟'}">
                                %{--
                                <button class="btn btn-sm btn-success" data-toggle="modal" data-target="#complete">完成</button> --}% %{--
                                <button class="btn btn-sm btn-danger" data-toggle="modal" data-target="#cancel">失败</button> --}%

                                <g:link action="complete" class="text-success" resource="${this.activity}" data-toggle="tooltip" data-placement="top" title="" data-original-title="完成">
                                    <i class="fa fa-check"></i>
                                </g:link>

                                <g:link action="cancel" class="text-danger" resource="${this.activity}" data-toggle="tooltip" data-placement="top" title="" data-original-title="取消">
                                    <i class="fa fa-times"></i>
                                </g:link>

%{--                                 <g:link action="delay" resource="${this.activity}" data-toggle="tooltip" data-placement="top" title="" data-original-title="推迟" class="btn btn-sm btn-warning">
                                    推迟
                                </g:link>
 --}%
                                <g:link action="edit" resource="${this.activity}" data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                                    <i class="icofont icofont-edit"></i>
                                </g:link>
                            </g:if>
                            <g:if test="${this.activity.status == '已完成' && this.displayRating}">
                                <g:link action="edit" resource="${this.activity}" data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                                    <i class="icofont icofont-edit"></i>
                                </g:link>
                            </g:if>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">
                        <!--当 flag = true， 跳转到 订单详情页-->
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">标题</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.name}</span>
                            </div>

                            <label class="col-md-2 col-form-label">执行人</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.assignedTo?.fullName}</span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">状态</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.status}</span>
                            </div>

                            <label class="col-md-2 col-form-label">所有者</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.user?.fullName}</span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">进展</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.progress}</span>
                            </div>


                        </div>

                        %{--
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">城市</label>
                            <div class="col-md-3">
                                <span class="cont">${this.activity?.city}</span>
                            </div>

                            <label class="col-md-2 col-form-label">地址</label>
                            <div class="col-md-3">
                                <span class="cont">${this.activity?.address}</span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">经度</label>
                            <div class="col-md-3">
                                <span class="cont">${this.activity?.longitude}</span>
                            </div>

                            <label class="col-md-2 col-form-label">纬度</label>
                            <div class="col-md-3">
                                <span class="cont">${this.activity?.latitude}</span>
                            </div>
                        </div>--}%

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">计划开始时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.startTime}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate></span>

                            </div>
                            <label class="col-md-2 col-form-label">计划结束时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.endTime}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">实际开始时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.actualStartTime}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate></span>

                            </div>
                            <label class="col-md-2 col-form-label">实际结束时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.actualEndTime}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">描述</label>

                            <div class="col-md-8">
                                <span class="cont">${this.activity?.description}</span>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- Hover table card end -->
                <div class="card">
                    <div class="card-header">
                        <h5>关联对象</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">客户</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.account?.name}</span>
                            </div>
                            <label class="col-md-2 col-form-label">联系人</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.contact?.fullName}</span>
                            </div>

                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">商机编号</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.opportunity?.serialNumber}</span>
                            </div>

                            <label class="col-md-2 col-form-label">资产</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.asset?.name}</span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">市场</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.campaign?.name}</span>
                            </div>

                            <label class="col-md-2 col-form-label">反馈</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.issue?.subject}</span>
                                <g:link controller="issue" action="show" resource="${this.activity.issue}">${this.activity?.issue?.subject}</g:link>
                            </div>
                        </div>

                    </div>

                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>其他活动信息</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">类型</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.type?.name}</span>
                            </div>

                            <label class="col-md-2 col-form-label">子类型</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.subtype?.name}</span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">开始时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.startTime}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                            </span>
                            </div>
                            <label class="col-md-2 col-form-label">结束时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.endTime}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                            </span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">创建时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.createdDate}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                            </span>
                            </div>
                            <label class="col-md-2 col-form-label">修改时间</label>

                            <div class="col-md-3">
                                <span class="cont">
                                <g:formatDate date="${this.activity?.modifiedDate}"
                                              format="yyyy-MM-dd HH:mm:ss"></g:formatDate>
                            </span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">创建人</label>

                            <div class="col-md-3">
                                <span class="cont">
                                ${this.activity?.createBy}
                            </span>
                            </div>
                            <label class="col-md-2 col-form-label">修改人</label>

                            <div class="col-md-3">
                                <span class="cont">
                                ${this.activity?.modifyBy}
                            </span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>服务完成意见及建议</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">评分</label>

                            <div class="col-md-3">
                                <span class="cont">${this.activity?.rating}</span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">备注</label>

                            <div class="col-md-8">
                                <span class="cont">${this.activity?.memo}</span>
                            </div>
                        </div>


                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>定制字段</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <g:render template="/layouts/mashTemplate/flexFieldInstanceTemplate" />
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>笔记</h5>

                        <div class="card-header-right">
                            <g:link controller="note" action="create" params="[activity: this.activity?.id]" data-toggle="tooltip" data-placement="top" title="" data-original-title="新增">
                                <i class="icofont icofont-plus"></i>
                            </g:link>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <g:render template="/layouts/mashTemplate/noteTemplate" />
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>团队</h5>

                        <div class="card-header-right">
                            <g:link controller="activityTeam" action="create" params="[activity: this.activity?.id]" data-toggle="tooltip" data-placement="top" title="" data-original-title="新增">
                                <i class="icofont icofont-plus"></i>
                            </g:link>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <g:render template="/layouts/mashTemplate/teamTemplate" />
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>文档</h5>

                        <div class="card-header-right">
                            <g:link controller="attachment" action="create" params="[activity: this.activity?.id]" data-toggle="tooltip" data-placement="top" title="" data-original-title="新增">
                                <i class="icofont icofont-plus"></i>
                            </g:link>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <g:render template="/layouts/mashTemplate/attachmentTemplate" />
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>任务</h5>

                        <div class="card-header-right">
                            <g:link controller="task" action="create" params="[activity: this.activity?.id]" data-toggle="tooltip" data-placement="top" title="" data-original-title="新增">
                                <i class="icofont icofont-plus"></i>
                            </g:link>
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div class="card-block dt-responsive">

                        <div class="table-responsive">
                            <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">

                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <g:sortableColumn property="name" title="名称"/>
                                        <g:sortableColumn property="progress" title="进展"/>
                                        <g:sortableColumn property="user" title="所有者"/>
                                        <g:sortableColumn property="active" width="8%" title="操作"/>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <g:each in="${this.activity?.tasks}">
                                        <tr>
                                            <td><g:link action="show" controller="task" id="${it?.id}"
                                                        class="firstTd">${it?.name}</g:link></td>
                                            <td>${it?.progress}</td>
                                            <td>${it?.user}</td>

                                            <td class="text-center">
                                              <g:link class="m-r-15 text-primary"
                                                      controller="task" action="edit"
                                                      id="${it?.id}">
                                                  <i class="icofont icofont-ui-edit"></i>
                                              </g:link>

                                                <g:form resource="${it}" class="inline" method="DELETE">
                                                    <button class="deleteBtn btn btn-danger btn-outline-danger btn-mini" type="button">
                                                        <i class="icofont icofont-trash"></i></button>
                                                </g:form>
                                            </td>
                                        </tr>
                                    </g:each>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </div>

            </div>
            <div class="card">
                <div class="card-header">
                    <h5>工作流</h5>

                    <div class="card-header-right">

                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>
                <g:render template="/layouts/mashTemplate/workflowInstanceTemplate"/>
            </div>

            <!-- Page-body end -->
        </div>
    </div>

</body>

</html>
